package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.ConvertMoney;
import com.red.star.wechat.data.entity.CouponPackage;
import com.red.star.wechat.data.entity.CouponPackageRelation;
import com.red.star.wechat.data.entity.ConvertCoupon;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @author xuquanyu
 * @date 2018/9/7.
 * 配置券包
 */
public interface CouponPackageMapper extends MyMapper<CouponPackage> {

    List<CouponPackage> couponPackageList(CouponPackage couponPackage);

    /**
     * 初始化领券报表数据
     * @param convertCoupon
     * @return
     */
    List<ConvertCoupon> listReceiveTicket(ConvertCoupon convertCoupon);

    List<CouponPackageRelation> selectCouponByCouponPackageId(@Param("couponPackageId") Integer couponPackageId);

    List<CouponPackageRelation> selectCouponIdByCouponPackageId(@Param("couponPackageId") Integer couponPackageId);

    void updateCouponPackageByIdAndStatus0(@Param("id") Integer id, @Param("status") Integer status);

    void updateCouponPackageByIdAndStatus(@Param("id") Integer id, @Param("status") Integer status);

    List<ConvertMoney> verificationReportList(ConvertMoney convertMoney);

    List<ConvertMoney>  selectConvertMoneyChannel();

    @Select(value = "SELECT  t.*   FROM  t_convert_money t  JOIN t_package_coupon tc ON t.coupon_id = tc.id  WHERE tc.id = #{id}")
    List<ConvertMoney>  selectCouponPackage(@Param("id") Integer id);

}
